from django.conf.urls.defaults import *
from django.contrib.syndication.views import feed as feed_view
from django.views.generic.list_detail import object_list
from pyplog.photos.feeds import *
from pyplog.photos.models import Gallery
from pyplog.photos.views import photo_detail, photo_list

feeds = {
	"all" : Photos,
	"artist" : PhotosByArtist,
	"gallery" : PhotosByGallery,
	"license" : PhotosByLicense,
	"location" : PhotosByLocation,
	"tag" : PhotosByTag,
}

public_galleries = Gallery.public_objects.all()

urlpatterns = patterns("",
	url(
		r"^$",
		object_list,
		{
			"queryset" : public_galleries,
			"extra_context" : {
				"feed_url" : "/photos/feeds/all-photos",
				"page_title" : "Galleries",
			},
			"template_name" : "photos/gallery_list.html",
			"template_object_name" : "gallery",
		},
		name = "gallery-index",
	),
	url(r"^detail/(?P<slug>.*)$", photo_detail, name = "photo-detail"),
	url(r"^feed/(?P<url>.*)/$", feed_view, { "feed_dict" : feeds }, name = "photo-feed"),
	url(r"^(?P<key>.*)/(?P<slug>.*)$", photo_list, name = "key-photos"),
)
